﻿using MyControlClassLibrary;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using WeifenLuo.WinFormsUI.Docking;

namespace MotionGTS
{
    public partial class Frm_GDI : DockContent
    {

        //创建委托提供给更新形状是使用
        public static Action<List<Shape>> acUpdateListBox = null;


        public Frm_GDI()
        {
            InitializeComponent();
            acUpdateListBox = new Action<List<Shape>>(UpdateListBox);
        }
        /// <summary>
        /// 绘制自定义轨迹
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, EventArgs e)
        {
            if (this.button1.Text == "开始-绘制自定义轨迹")
            {
                Frm_Coordinates.acSetDrawingMode(DrawingMode.CustomPath);
                this.button1.Text = "结束-绘制自定义轨迹";
            }
            else
            {
                Frm_Coordinates.acSetDrawingMode(DrawingMode.None);
                this.button1.Text = "开始-绘制自定义轨迹";
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            Frm_Coordinates.acCreatePointMarkers();
        }

        public void UpdateListBox(List<Shape> shapes)
        {
            this.listBox1.DataSource = null;
            this.listBox1.DataSource = shapes;
        }

        private void button9_Click(object sender, EventArgs e)
        {

        }

        private void button3_Click(object sender, EventArgs e)
        {
            Frm_Coordinates.acStartAnimation();//启动绘制动画
        }

        private void button4_Click(object sender, EventArgs e)
        {
            Frm_Coordinates.acStopAnimation();//启动停止动画
        }
    }
}
